package com.outlook.servlet.tree;

import java.util.Locale;

import com.outlook.util.RandomUtil;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * 
 * @author watson
 *
 */
public class LoadServlet extends NoteServlet {

	private static final long serialVersionUID = 1L;

	@Override
	public JSONArray getNote() {
		JSONArray array = new JSONArray();
		JSONObject object = new JSONObject();
		for(int i=0; i<10; i++) {
			JSONObject tmp = new JSONObject();
			tmp.put("id", i);
			if(RandomUtil.random.nextBoolean()) {
				tmp.put("r_url", "load?type=load");
				tmp.put("c_url", "create.html");
				tmp.put("u_url", "edit.html");
				tmp.put("d_url", "delete.html");
			}
			object.put("attributes", tmp);
			
			if(RandomUtil.random.nextBoolean()) {
				object.put("state", "closed");
			}
			
			object.put("data", RandomUtil.getRandomString(Locale.ENGLISH));
			array.add(object);
		}
		return array;
	}
	
}
